package com.itheima.zixi3.Mapbianli;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Jianzhidui {
    public static void main(String[] args) {
        Map<String, Double> map = new HashMap<>();
        map.put("张三", 99.9);
        map.put("李四", 98.9);
        map.put("王五", 97.9);
        map.put("赵六", 96.9);
        //调用Map集合中的entrySet方法，获取map集合中的所有键值对
        Set<Map.Entry<String, Double>> entries = map.entrySet();
        //entrySet集合中的元素是Entry对象，Entry对象是Map接口的子接口
        for (Map.Entry<String, Double> entry : entries) {
            String key = entry.getKey();
            Double value = entry.getValue();
            System.out.println(key+"---"+value);
        }

    }
}
